layui.define(['jquery', 'http', 'apiCombo'], function (exports) {
        var $ = layui.$,
            http = layui.http.service,
            api = layui.apiCombo;

        var comboServices = {
            /**
             * @author: ares
             * @date: 2021/3/8 16:35
             * @description: 新增套餐
             * @param {object}data
             * @returns {Promise.<TResult>}
             */
            create: function (data) {
                return http(api.create, {method: "post", data: data});
            },
            /**
             * @author: ares
             * @date: 2021/3/18 21:53
             * @description: 删除套餐
             * @param {string}id   套餐id
             * @returns {Promise.<TResult>}
             */
            remove: function (id) {
                var params = {id: id};
                return http(api.remove, {method: "post", params: params});
            },
            /**
             * @author: ares
             * @date: 2021/3/8 16:35
             * @description: 更新套餐
             * @param {object}data
             * @returns {Promise.<TResult>}
             */
            update: function (data) {
                return http(api.update, {method: "post", data: data});
            },
            /**
             * @author: ares
             * @date: 2021/3/8 16:40
             * @description: 查询套餐列表
             * @param {string}type  类别  1评估|2训练
             * @returns {Promise.<TResult>}
             */
            getList: function (type) {
                var params = {
                    type: type,
                };
                return http(api.list, {params: params});
            },
            /**
             * @author: ares
             * @date: 2021/3/8 16:40
             * @description: 分页查询套餐列表
             * @param {number}page
             * @param {number}pageSize
             * @param {object}params  额外参数
             * @returns {Promise.<TResult>}
             */
            getPageList: function (page, pageSize, params) {
                var _params = {
                    page: page,
                    pageSize: pageSize,
                };
                $.extend(_params, params);
                return http(api.pageList, {params: _params});
            },

            /**
             * @author: ares
             * @date: 2021/3/8 16:43
             * @description: 查询套餐详情
             * @param {string}pid
             * @returns {Promise.<TResult>}
             */
            getDetail: function (pid) {
                var params = {
                    pid: pid,
                };
                return http(api.detail, {params: params});
            },

            /**
             * @author: ares
             * @date: 2021/3/8 20:19
             * @description: 根据套餐id查询套餐项目
             * @param {string}pid
             * @returns {Promise.<TResult>}
             */
            getComboItemService: function (pid) {
                var params = {
                    pid: pid,
                };
                return http(api.getComboItem, {params: params});
            },

            /**
             * @author: ares
             * @date: 2021/3/8 20:21
             * @description: 根据处方类别和治疗单类别查询治疗项目
             * @param {string}type   处方类别  1康复|2训练
             * @param {string}typeId  治疗单类别
             * @returns {Promise.<TResult>}
             */
            getSubItemService: function (type, typeId) {
                var params = {
                    type: type,
                    typeId: typeId,
                };
                return http(api.getSubItem, {params: params});
            },

        }

        exports("comboServices", comboServices);
    }
)